#ifndef D_CAMERA_H
#define D_CAMERA_H

#include "d_Math.h"
#include "d_Light.h"

using namespace d_Math;

enum 
{
	D_LEFT, D_MIDDLE, D_RIGHT
};

class d_Camera
{
public:
	d_Camera();
	~d_Camera()
	{
		delete light;
	}
	int getW(){return dimensions[0];}
	int getH(){return dimensions[1];}

	void setDimensions(int w, int h);
	void setViewport(int x, int y, int w, int h);
	void setPerspective(double foy);
	void setPosition(double x, double y, double z);
	void setDirection(double x, double y, double z);
	void setUpDirection(double x, double y, double z);

	void applyViewport();
	void applyPerspective();
	void applyOrthographic();
	void resetPerspective();
	void applyModelview();
	void addLight(GLint gl_light);

	void setDrag(int x, int y);
	void applyDrag(int x, int y);
	void mouseClick(int button, int x, int y);
	void mouseDrag(int x, int y);
	void mouseRelease(int x, int y);
private:
	void zoom(int y);
	int button_state;
	int start_click[2];
	int last_pos[2];
	bool is_light;
	d_Light *light;
	int dimensions[2];
	int viewport[4];
	float perspective[2];
	d_Vec3f pos;
	d_Vec3f dir;
	d_Vec3f up;
};

#endif

